package com.graduate.daydayup.activity

import android.os.Bundle
import com.blankj.utilcode.util.ToastUtils
import com.graduate.daydayup.App
import com.graduate.daydayup.R
import com.graduate.daydayup.base.BaseActivity
import com.graduate.daydayup.room.Account
import com.graduate.daydayup.room.MyRoomDataBase
import kotlinx.android.synthetic.main.activity_register.*

class RegisterActivity :BaseActivity() {
    override fun setTitle()=""

    override fun getLayout()= R.layout.activity_register

    override fun setTextRight()=""

    override fun setImgRightListener() {

    }

    override fun isAddToolbar()=false

    override fun initViewIds() {
        btn_register.setOnClickListener {
            if (et_account.text.toString().isEmpty()){
                ToastUtils.showShort("账户为空")
            }else if (et_pass.text.toString().isEmpty()){
                ToastUtils.showShort("密码为空")
            }else{
                MyRoomDataBase.getInstance(this).accountDao().addAccount(  Account(0,et_account.text.toString(),et_pass.text.toString()))
                ToastUtils.showShort("注册成功")
                finish()
            }
        }
        btn_cancel.setOnClickListener {
            finish()
        }
    }

    override fun initView() {

    }

    override fun initData(savedInstanceState: Bundle?) {

    }
}